package com.fanghuaiming.seata.item.controller;

import com.fanghuaiming.seata.item.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/****
 * @description: 商品服务接口
 * @version:1.0.0
 * @author fanghuaiming
 * @data Created in 2020/11/27 下午2:00
 *
 */
@RestController("item")
@RequestMapping("/item")
@Slf4j
public class ItemController {

    /**
     * 商品服务
     */
    @Autowired
    private ItemService itemService;

    /**
     * @Description: 扣减商品库存
     *
     * @param:
     * @return:
     * @auther: fanghuaiming
     * @date: 2020/11/30 下午6:29
     * @version:1.0.0
     */
    @GetMapping("/decreaseItem")
    public String decreaseItem(Long productId, Integer count) {
        itemService.decrease(productId,count);
        return "减少商品库存成功";
    }

}
